package main

import (
	"context"
	"fmt"
	"test1/protocol"

	"google.golang.org/grpc"
)

func main() {
	conn, err := grpc.Dial(":8080", grpc.WithInsecure())
	if err != nil {
		fmt.Printf("连接服务端失败: %s", err)
		return
	}
	defer conn.Close()

	c := protocol.NewShufflerClient(conn)

	cards := make([]int32, 10)
	for i := 0; i < 10; i++ {
		cards[i] = int32(i)
	}

	r, err := c.ShuffleCards(context.Background(), &protocol.SCardsRequest{CardsArr: cards})
	if err != nil {
		fmt.Printf("调用服务端代码失败: %s", err)
		return
	}
	fmt.Printf("调用成功: %v", r.CardsArr)
}
